package day08.test1;

public class test1 {
    public static void main(String[] args) {
        Emp e = new Emp();
        //引用存储了对象的地址
        System.out.println(e);


        e.name = "张三";
        e.age = 20;
        e.id = 123456;
        e.sal = 5000.0;
        test1.printEmp(e);
        e.printfInfo();

        Emp e2 = new Emp();
        e2.name = "李四";
        e2.age = 20;
        e2.id = 123456;
        e2.sal = 520.0;
        e2.printfInfo();
    }
    public static void printEmp(Emp e)
    {
        System.out.println(e.name);
        System.out.println(e.age);
        System.out.println(e.id);
        System.out.println(e.sal);

    }

}

//定义类
class Emp{
    String name;
    int age;
    int id;
    double sal;//薪资

    public void printfInfo()
    {
        System.out.println("姓名"+name);
        System.out.println("年龄"+age);
        System.out.println("工号"+id);
        System.out.println("薪资"+sal);

    }
}
